<style>
	.activeTr {
		background-color: #3c8dbc;
    	color: #fff;
	}
</style>
<!--
	作者：leeeeyx@hotmail.com
	时间：2017-06-27
	描述：看板列表
-->
<div class="content-wrapper" style="min-height: 901px;">
	<!-- Content Header (Page header) -->
	<section class="content-header">
		<h1 style="text-align:center">
        	看板管理
      </h1>
	</section>

	<!-- Main content -->
	<section class="content">
		<div class="row">
			<div class="col-md-12">
				<div class="box">
					<div class="box-header">						
						<div class='col-md-2'>
							<input type="text" class="form-control" id="datepicker" placeholder="请选择日期" readonly="readonly" ng-model="selectDate">
						</div>
						<button class="btn btn-default" ng-click="searchBoard()"><i class="fa fa-search"></i>&nbsp;查询</button>
						<button class="btn btn-primary pull-right" data-toggle="modal" data-target="#newBoard"><i class="fa fa-plus"></i>&nbsp;新增</button>
					</div>
					<div class="box-body table-responsive no-padding">
						<table class="table table-hover">
							<thead>
								<tr>
									<th>餐别名称</th>
									<th>加工车间</th>
									<th>加工开始时间</th>
									<th>加工结束时间</th>
									<th>车间负责人</th>
									<th>加工状态</th>
									<th style="width: 20%;">操作</th>
								</tr>
							</thead>
							<tbody ng-repeat="item in items track by $index">
								<tr>
									<th rowspan="{{item.details.length+1}}">{{item.period_time_name}}</th>
								</tr>
								<tr ng-repeat="d in item.details track by $index">
									<th>{{d.workshop_name}}</th>
									<th>{{d.start_time}}</th>
									<th>{{d.end_time}}</th>
									<th>{{d.user_name}}</th>
									<th ng-if="d.manufacturing_status == 0">未开始</th>
									<th ng-if="d.manufacturing_status == 1">进行中</th>
									<th ng-if="d.manufacturing_status == 2">已完成</th>
									<th ng-if="d.manufacturing_status == 3">中断(人员)</th>
									<th ng-if="d.manufacturing_status == 4">中断(物料)</th>
									<th>
										<a href="" class="btn btn-lg edit" style="padding:0px" title="修改" ng-click="showDetail(item.product_manufacturing_plan_id,d.workshop_id,d.user_name,d.workshop_name,item.period_time_name)"><i class="fa fa-edit"></i></a>
										<!--<a href="" class="btn btn-lg del" style="padding:0px" title="删除" ng-click="delBoard(d.id)"><i class="fa  fa-close"></i></a>-->
									</th>
								</tr>
							</tbody>
						</table>
					</div>
					<!-- /.box-body -->
					<div class="box-footer" style="margin-bottom:10px;">

						<div class="dataTables_info col-sm-2" id="example1_info" role="status" aria-live="polite">总条目数：{{totalNums}}</div>
						<div class="col-md-6 col-md-offset-4">
							<ul class="pagination pull-right" style="margin: 0px;">
								<li class="paginate_button previous" id="example1_previous">
									<a ng-click="Previous()">上一页</a>
								</li>
								<li ng-repeat="page in pageList" ng-class="{active: isActivePage(page)}">
									<!-- class=" paginate_button active" -->
									<a ng-click="selectPage(page)">{{page}}</a>
								</li>
								<li class="paginate_button next" id="example1_next">
									<a ng-click="Next()">下一页</a>
								</li>
							</ul>
						</div>

					</div>
				</div>
				<!-- /.box -->
			</div>
		</div>
	</section>
	<!-- /.content -->
</div>
<!--
	作者：leeeeyx@hotmail.com
	时间：2017-06-29
	描述：选择生产计划
-->
<div class="modal fade" id="newBoard" tabindex="-1" role="dialog" aria-labelledby="myModalLabel">
	<div class="modal-dialog" role="document">
		<div class="modal-content">
			<div class="modal-header">
				
				
				<button type="button" class="close" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">&times;</span></button>
				<h4 class="modal-title" id="myModalLabel">生产计划</h4>
				<div class="row">
					<div class='col-md-4'>
							<input type="text" class="form-control" id="datepicker2" placeholder="请选择日期" readonly="readonly" ng-model="productPlanDate">
					</div>
					<button class="btn btn-default" ng-click="searchProductPlan()">查询</button>
				</div>
			</div>
			<div class="modal-body" style="height: 600px;overflow-y: auto;"> 
				<table class="table">
							<tbody>
								<tr>
									<td>餐别</td>
									<td>设置人</td>
									<td>设置时间</td>
								</tr>
								<tr class="pPlan" ng-repeat="p in productPlans track by $index" ng-click="choosePlan(p.plan_id,$event)">
									<td>{{p.period_time_name}}</td>
									<td>{{p.create_by}}</td>
									<td>{{p.create_time | limitTo :10}}</td>
								</tr>
							</tbody>
					</table>						
			</div>
			<div class="modal-footer">
	        	<button type="button" class="btn btn-default btn-lg pull-left" data-dismiss="modal">取消</button>
	        	<button type="button" class="btn btn-primary btn-lg" ng-click="newBoard()">确定</button>
	      	</div>
		</div>
	</div>
</div>
<!--
	作者：leeeeyx@hotmail.com
	时间：2017-08-08
	描述：删除看板确认
-->
<div class="modal fade" id="delboard" tabindex="-1" role="dialog" aria-labelledby="myModalLabel">
	<div class="modal-dialog" role="document">
		<div class="modal-content">
			<div class="modal-header">提示
			</div>
			<div class="modal-body"> 
					确定删除该条看板记录吗？
			</div>
			<div class="modal-footer">
	        	<button type="button" class="btn btn-default btn-lg pull-left" data-dismiss="modal">取消</button>
	        	<button type="button" class="btn btn-primary btn-lg" ng-click="sureDelBoard()">确定</button>
	      	</div>
		</div>
	</div>
</div>
<!--
	作者：leeeeyx@hotmail.com
	时间：2017-08-08
	描述：查看看板详情
-->
<div class="modal fade" id="boardDetail" tabindex="-1" role="dialog" aria-labelledby="myModalLabel">
	<div class="modal-dialog" role="document" style="width:75%;">
		<div class="modal-content">
      <div class="modal-header">
        <button type="button" class="close" data-dismiss="modal" aria-label="Close" ng-click="searchBoard()"><span aria-hidden="true">&times;</span></button>
        <h4 class="modal-title" style="text-align:center;height: 55px;">看板详情</h4>
      	<p class="col-md-3">餐别：{{detailPname}}</p><p class="col-md-3">车间：{{detailWname}}</p><p class="col-md-3">车间负责人：{{detailmanagerName}}</p>
      </div>
      <div class="modal-body form-horizontal">
       <div class="box-body">
          <div class="row"> <!-- 300  -->
           <div class="col-md-12">
              	
            
            <!-- /.box-header -->
            <div class="box-body table-responsive no-padding" style="height: 300px;overflow: auto;">
              <table class="table table-hover" >
              	<thead>
	                <tr>
	                  <th>成品名称</th> 
	                  <th>总数量</th>
	                  <th>单位</th>
	                  <th>工序名称</th>
	                  <th>加工开始时间</th>
	                  <th>加工结束时间</th>
	                  <th>负责人</th>
	                  <th>加工状态</th>
	                </tr>
                </thead>
               	<tbody >
	                <tr ng-repeat = "de in details track by $index" ng-click="editDetail(de)">
	                	<td>{{de.product_name}}</td>
	                	<td>{{de.count}}</td>
	                	<td>{{de.unit_name}}</td>
	                	<td>{{de.procedure_name}}</td>
	                	<td>{{de.expected_start_time}}</td>
	                	<td>{{de.expected_complete_time}}</td>
	                	<td>{{de.user_name}}</td>
	                	<td>{{de.manufacturing_status}}</td>
	                </tr>
               	</tbody>
              </table>
            </div>
            <!-- /.box-body -->
           </div>
            <!-- /.col -->
          </div>
          <!-- /.row -->
        </div>
        <!-- /.box-body -->
      
        </div>
      
      <div class="modal-footer">
        <button type="button" class="btn btn-default btn-lg col-md-4 col-md-offset-4" data-dismiss="modal" ng-click="searchBoard()">确定</button>
      </div>
    </div>
	</div>
</div>
<!--
	作者：leeeeyx@hotmail.com
	时间：2017-08-08
	描述：修改单条看板记录
-->
<div class="modal fade" id="showEditDetail" tabindex="-1" role="dialog" aria-labelledby="myModalLabel">
	<div class="modal-dialog" role="document">
		<div class="modal-content">
			<div class="modal-header">修改{{editName}}看板
			</div>
			<div class="modal-body form-horizontal">
				<div class="form-group">
	               <label class="col-sm-3 control-label">加工数量</label>
	               <div class="col-sm-9">
	                  <input type="text" class="form-control" placeholder="加工数量" ng-model="editObj.count" ng-required='true'>
	               </div>
	            </div>
				<div class="form-group">
	               <label class="col-sm-3 control-label">开始时间</label>
	               <div class="col-sm-9">
	                  <input type="text" class="form-control" placeholder="开始时间" ng-model="editObj.expected_start_time" ng-required='true'>
	               </div>
	            </div>
	            <div class="form-group">
	               <label class="col-sm-3 control-label">结束时间</label>
	               <div class="col-sm-9">
	                  <input type="text" class="form-control" placeholder="结束时间" ng-model="editObj.expected_complete_time" ng-required='true'>
	               </div>
	            </div>
	            <div class="form-group">
	               <label class="col-sm-3 control-label">责任人</label>
	               <div class="col-sm-9">
	                  <select class="form-control" ng-model="editObj.user_id">
	                  	<option ng-repeat="us in cUsers track by $index" value="{{us.id}}">{{us.name}}</option>
	                  </select>
	               </div>
	            </div>
			</div>
			<div class="modal-footer">
	        	<button type="button" class="btn btn-default btn-lg pull-left" data-dismiss="modal">取消</button>
	        	<button type="button" class="btn btn-primary btn-lg" ng-click="subEdit()">确定</button>
	      	</div>
		</div>
	</div>
</div>